package cn.iocoder.yudao.module.xhyy.controller.app.notice;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.xhyy.controller.app.notice.vo.AppNoticePageReqVO;
import cn.iocoder.yudao.module.xhyy.controller.app.notice.vo.AppNoticeRespVO;
import cn.iocoder.yudao.module.xhyy.dal.dataobject.notice.NoticeXHDO;
import cn.iocoder.yudao.module.xhyy.service.notice.NoticeXHService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 APP - 通知")
@RestController
@RequestMapping("/xhyy/notice")
@Validated
public class AppNoticeController {

    @Resource
    private NoticeXHService noticeXHService;


    @GetMapping("/page")
    @Operation(summary = "获得通知分页")
    public CommonResult<PageResult<AppNoticeRespVO>> getNoticePeiZhenPage(@Valid AppNoticePageReqVO pageReqVO) {
        PageResult<NoticeXHDO> pageResult = noticeXHService.getNoticePeiZhenPage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, AppNoticeRespVO.class));
    }



}